//
//  BatQuai.m
//  PhongThuyLibrary
//
//  Created by Le Anh Tai on 11/10/13.
//  Copyright (c) 2013 Phuong Le. All rights reserved.
//

#import "BatTrach.h"
#import "FengShuiCore.h"

@implementation BatTrach

- (id)initWithTrach:(NSString*)trach
{
    self = [super init];
    if (self)
    {
        _trach = trach;
    }
    
    return self;
}

- (NSString *)getThuocCuuTinh
{
    NSInteger index = [BAT_CUNG indexOfObject:_trach];
    if (index == NSNotFound)
    {
        return nil;
    }
    
    return [CUU_TINH objectAtIndex:index];
}

- (NSString *)getThuocAmDuong
{
    NSInteger index = [BAT_TRACH_DUONG indexOfObject:_trach];
    if (index != NSNotFound)
    {
        return VI_DUONG;
    }
    
    index = [BAT_TRACH_AM indexOfObject:_trach];
    if (index != NSNotFound)
    {
        return VI_AM;
    }
    
    return nil;
}

- (NSString *)getThuocHanh
{
    if ([_trach isEqualToString:_SANH_KHI]) return HANH_MOC;
    if ([_trach isEqualToString:_THIEN_Y]) return HANH_THO;
    if ([_trach isEqualToString:_DIEN_NIEN]) return HANH_KIM;
    if ([_trach isEqualToString:_PHUC_VI]) return HANH_THUY;
    if ([_trach isEqualToString:_NGU_QUY]) return HANH_HOA;
    if ([_trach isEqualToString:_TUYET_MENH]) return HANH_KIM;
    if ([_trach isEqualToString:_LUC_SAT]) return HANH_THUY;
    if ([_trach isEqualToString:_HOA_HAI]) return HANH_THO;
    
    return nil;
}

- (NSArray*)getKietTaiNamThang
{
    if ([_trach isEqualToString:_SANH_KHI]) return @[CHI_HOI,CHI_MEO,CHI_MUI];
    if ([_trach isEqualToString:_THIEN_Y]) return @[CHI_THIN,CHI_TUAT,CHI_SUU,CHI_MUI];
    if ([_trach isEqualToString:_DIEN_NIEN]) return @[CHI_TY5,CHI_DAU,CHI_SUU];
    if ([_trach isEqualToString:_TUYET_MENH]) return @[CHI_TY5,CHI_DAU,CHI_SUU];
    if ([_trach isEqualToString:_LUC_SAT]) return @[CHI_THAN,CHI_TY1,CHI_THIN];
    
    return nil;
}

- (NSArray*)getHungTaiNamThang
{
    if ([_trach isEqualToString:_NGU_QUY]) return @[CHI_DAN,CHI_NGO,CHI_TUAT];
    if ([_trach isEqualToString:_LUC_SAT]) return @[CHI_THIN,CHI_TUAT,CHI_SUU,CHI_MUI];
    if ([_trach isEqualToString:_HOA_HAI]) return @[CHI_THIN,CHI_TUAT,CHI_SUU,CHI_MUI];
    
    return nil;
}

@end
